<?php

/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/



/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/

Route::group(['middleware' => ['web']], function () {

    Route::get("/adminLogin","Admin\AdminController@adminLogin");  //商家登录页
    Route::post("/_adminLogin","Admin\AdminController@_adminLogin");  //商家执行登录
    Route::get("/adminLogout","Admin\AdminController@adminLogout");  //商家退出登录
    Route::get('/adminRegister','Admin\AdminController@adminRegister');//商家注册页
    Route::post('/_adminRegister','Admin\AdminController@_adminRegister');//商家执行注册

    Route::group(['namespace' => 'Index'],function (){
        Route::get("/","IndexController@index");  //首页
        Route::get("/login","IndexController@login");  //登录页面
        Route::post("/_login","IndexController@_login"); //执行登录
        Route::get("/register","IndexController@register");  //注册页面
        Route::post("_register","IndexController@_register");//执行注册
        Route::get('/serviceInfo/{id}','IndexController@serviceInfo');//商品详情
        Route::get('/shop/{id}','IndexController@shop');//进入店铺
        Route::group(['middleware' => ['LoginUserCheck']],function (){
            Route::post("toTask","IndexController@toTask");//下单
            Route::get('/myTask','IndexController@myTask');//我的订单
            Route::get('/toEndTask/{id}','IndexController@toEndTask');//已取件
        });
    });






    //管理员
    Route::group(['middleware' => ['LoginAdminCheck']], function () {
        Route::group(['namespace' => 'Admin'],function (){
            Route::get("/addService","ShopController@addService"); //添加业务页面
            Route::post('/_addService','ShopController@_addService');//执行添加业务
            Route::get("/searchService","ShopController@searchService"); //业务管理
            Route::get('/delService/{id}','ShopController@delService');//删除业务

            Route::get('/getTask','ShopController@getTask');//收到的订单
            Route::get('/toDoTask/{id}','ShopController@toDoTask');//下载附件并接单
            Route::get('/tasking','ShopController@tasking');//制作中的订单
            Route::get('/toTasked/{id}','ShopController@toTasked');//制作完成
            Route::get('/tasked','ShopController@tasked');//制作完成的订单
            Route::get('/endTask','ShopController@endTask');//已取走的订单
        });
    });





});
